<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<h3>电力机车技术速度计算方法</h3>
<br>
机车走行公里:
<br>
<input type="text" id="distance">
<select name="select1" id="select1" onchange="change1()">
    <option value="262">兰哈 -262KM-</option>
    <option value="273">哈广(广元南) -273KM-</option>
    <option value="267">哈广(广元西) -267KM-</option>
    <option value="273">广哈(广元南) -273KM-</option>
    <option value="267" >广哈(广元西) -267KM-</option>
    <option value="262">哈兰 -262KM-</option>
</select>
<br>

总转运时间:<br><input type="text" id="sumTime">
<br>

站停时间:<br><input type="text" id="stopTime">
<br>
<input type="submit" value="计算" onclick="do1()">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" value="清空" onclick="clear1()"><br>
技术速度(Km/h):<br><input type="text" id="speed" disabled>
<br>
<hr>
<h3>电力机车单耗计算方法</h3>

        机车总重量<input type="text" id="机车总重量"><br>
        编组单牵引总重<input type="text" id="编组单牵引总量"><br>

        运行距离<input type="text" id="运行距离" style="width: 80px">
        <select name="select2" id="select2" onchange="change2()">
            <option value="262">兰哈262KM</option>
            <option value="273">哈广(广元南)273KM</option>
            <option value="267">哈广(广元西)267KM</option>
            <option value="273">广哈(广元南)273KM</option>
            <option value="267" >广哈(广元西)267KM</option>
            <option value="262">哈兰262KM</option>
        </select><br>
        A节接E2<input type="text" id="电度表接电量E2" style="width: 80px">B节接E2<input type="text" id="B电度表接电量E2" style="width: 80px"><br>
        A节交E2<input type="text" id="电度表交电量E2" style="width: 80px">B节交E2<input type="text" id="B电度表交电量E2" style="width: 80px"><br>
        A节接E1<input type="text" id="电度表接电量E1" style="width: 80px">B节接E1<input type="text" id="B电度表接电量E1" style="width: 80px"><br>
        A节交E1<input type="text" id="电度表交电量E1" style="width: 80px">B节交E1<input type="text" id="B电度表交电量E1" style="width: 80px"><br>
<input type="submit" value="计算" onclick="do2()">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" value="清空" onclick="clear2()">
<br>
    电力机车单耗(度/万吨公里)<br><input type="text" id="电力机车单耗" disabled>
<br>
    通过总量<br><input type="text" id="通过总量" disabled>
<br>
    本列实际用电量<br><input type="text" id="本列实际用电量" disabled>
<br>
    通过总重(万吨公里)<br><input type="text" id="通过总重" disabled>
<br>
    本列用电量<br><input type="text" id="本列用电量" disabled>
<br>
        本列再生制动发电量<br><input type="text" id="本列再生制动发电量" disabled>

</body>
<script !src="">
    function change1() {
        document.getElementById("distance").value = document.getElementById("select1").value
    }
function do1() {
    let distance = document.getElementById("distance").value;
    let sumTime = document.getElementById("sumTime").value;
    let stopTime = document.getElementById("stopTime").value;
    document.getElementById("speed").value = distance/(sumTime-stopTime);
}
    function clear1() {
        document.getElementById("distance").value = "";
        document.getElementById("sumTime").value = "";
        document.getElementById("stopTime").value = "";
    }
    function change2() {
        document.getElementById("运行距离").value = document.getElementById("select2").value
    }
    function do2() {
        let 机车总重量 = document.getElementById("机车总重量").value;
        let 编组单牵引总量 = document.getElementById("编组单牵引总量").value;
        document.getElementById("通过总量").value = Number(机车总重量)+Number(编组单牵引总量);
        let 通过总量 = document.getElementById("通过总量").value;
        let 运行距离 = document.getElementById("运行距离").value;
        document.getElementById("通过总重").value = (运行距离*通过总量)/10000;
        let 电度表接电量E2 = document.getElementById("电度表接电量E2").value;
        let 电度表交电量E2 = document.getElementById("电度表交电量E2").value;
        let 电度表接电量E1 = document.getElementById("电度表接电量E1").value;
        let 电度表交电量E1 = document.getElementById("电度表交电量E1").value;
        let B电度表接电量E2 = document.getElementById("B电度表接电量E2").value;
        let B电度表交电量E2 = document.getElementById("B电度表交电量E2").value;
        let B电度表接电量E1 = document.getElementById("B电度表接电量E1").value;
        let B电度表交电量E1 = document.getElementById("B电度表交电量E1").value;
        document.getElementById("本列用电量").value = Number(电度表交电量E1)-Number(电度表接电量E1)+Number(B电度表交电量E1)-Number(B电度表接电量E1);
        document.getElementById("本列再生制动发电量").value = Number(电度表交电量E2)-Number(电度表接电量E2)+Number(B电度表交电量E2)-Number(B电度表接电量E2);
        let 本列用电量 = document.getElementById("本列用电量").value;
        let 本列再生制动发电量 = document.getElementById("本列再生制动发电量").value;
        document.getElementById("本列实际用电量").value = 本列用电量-本列再生制动发电量;
        let 本列实际用电量 = document.getElementById("本列实际用电量").value;
        let 通过总重 = document.getElementById("通过总重").value;
        document.getElementById("电力机车单耗").value = 本列实际用电量/通过总重;
    }
    function clear2() {
        document.getElementById("机车总重量").value = "";
        document.getElementById("编组单牵引总量").value = "";
        document.getElementById("通过总量").value = "";
        document.getElementById("运行距离").value = "";
        document.getElementById("电度表交电量E1").value = "";
        document.getElementById("电度表接电量E1").value = "";
        document.getElementById("电度表交电量E2").value = "";
        document.getElementById("电度表接电量E2").value = "";
        document.getElementById("本列用电量").value = "";
        document.getElementById("本列再生制动发电量").value = "";
        document.getElementById("本列实际用电量").value = "";
        document.getElementById("通过总重").value = "";
    }



</script>
</html>